Skip to content

feat(canvas): carry private's cut, grouping, measuring, mentions and agent write guards - #549

Merged
kgoedecke merged 13 commits into
mainfrom
sync/private-2026-11-19
Nov 19, 2026
Merged

kgoedecke merged 13 commits into
mainfrom
sync/private-2026-11-19

Conversation

@kgoedecke

Copy link
Copy Markdown
Collaborator

Ports eleven commits from the private repo that had not reached this one. Each is a cherry-pick -x with its original subject.

What comes over

Adapted for this repo

  • CanvasPage.tsx: the held-⌘X guard sits in the action-registry key handler this repo has.
  • Stage.tsx: the hosted integrations' stage overlay line is left out; the comment deep link reads the store the way the page-entry layout effect here does.
  • history.ts: the grouping port drops two imports that belong to lazy page loading, which is not here.
  • server/mcp.ts: heldForms compares against the stored and compact HTML only, since frames here are not composed on read.
  • tests/elementContextMenuBrowser.test.ts: two expectations now include Cut.

Left out

Checks

typecheck, lint and format:check pass locally. The full suite passes except tests/serverListen.test.ts, which fails the same way on an untouched main on my machine (IPv6 listen).

🤖 Generated with Claude Code

kgoedecke and others added 13 commits November 19, 2026 00:16
…468)

* feat(canvas): cut frames and elements with ⌘X and the context menus

⌘X (the native cut event, so the desktop Edit menu's Cut works too) copies
the picked elements, else the selected frames, and removes what ⌫ would once
the clipboard took the copy. The frame and element context menus gain Cut;
their asynchronous clipboard write deletes only after it succeeds, so a
denied write loses nothing. Locked frames and layers are copied but stay.

Fixes #333

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(canvas): copy the live frames a menu cut deletes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b0b11db47b6b53fcf0d63a511f81f5a7db2180a8)
#566)

* feat(mcp): inspect_frame for MCP agents, with a layout problems report

The resident agent's inspect_frame reaches MCP agents: the rendered frame as
data (design summary, element outline with boxes and computed styles), now
with selectors to report on chosen elements and a problems list: content
past the frame's edge (everything below its height as one line), text cut
off by its box, and text or controls overlapping, measured on what clipping
ancestors leave visible and per line for wrapped inline text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): inspect_frame reports text cut off vertically, and every asked-for match

Two gaps from review. A fixed-height text box with overflow hidden lost
lines without a problem, since only horizontal overflow of the box's own
text was checked. And asked-for selectors shared the outline's 64-element
limit, so later selectors could come back empty without appearing in
unmatched: each now gets its own 20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8f20caf2ca8b51f33286b6be436cd50ad60676c2)
…nsitions (#576)

* fix(ios): sharp frames at every zoom, no jitter from scale-change transitions

Frames were soft at most zoom levels: Core Animation stretches each frame
bitmap with a linear filter, and while the camera offset rested on whole
device pixels, each frame's origin did not (nor did the first fit), so most
zooms blurred every glyph by up to half a pixel. Frame layers now snap to the
device-pixel grid at the camera's density, and tiles reach screen density at
the deepest zoom (cap 8 -> 12 on a 3x screen).

Frames with `transition: all` jittered by a pixel or two and repainted
forever: base and tile paint one document at different scales, and each scale
change recomputed device-pixel-snapped border widths, which started CSS
transitions. The Blitz and Stylo forks now restyle a scale change with
TraversalFlags::DeviceChangeOnly, which starts no transitions (kgoedecke/blitz
35a984f, kgoedecke/stylo 39c0595); rust/tests/rescale_transitions.rs covers it.

Playing frames keep one tile: playback paints at screen density within a
one-screen budget, no static tile is painted between its steps, and only a
playback step decides that an animation ended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ios): size frame layers to the bitmap's whole pixels, test animations advance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 81848d46a1e81ac08c3ba43989b5c3d1bbffd818)
* fix(comments): keep an open thread above the frame size badge

The selected frame's size badge is drawn in a screen-space layer after the
world, so it painted over any open comment thread. An open thread is now
portalled into its own screen-space layer above the badges and kept on its
pin as the camera pans and zooms (as Figma's thread does), and as frames
move. The badge also hides while its frame's comment composer is open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(comments): check an open thread paints above another frame's size badge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit eccfaa30a4c4c913d3a0ed16b7a2c961a6ab1cec)
* feat(canvas): remove the element toolbar over a picked element

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(canvas): keep an element link for readers in the frame menu

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit a614f88da82f6a3b3f6abfbec7863b4e4d94be1e)
The send button was pushed outside the composer at phone width and the
GitHub mark in the connect bar was squeezed to a dot. Below md the model
button hides the effort level (still set in its menu) and shrinks to
truncate, Files is icon-only, and path-based brand marks no longer shrink.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit bb90742e6cd23574e09de4d139e4b5cf017917ad)
…591)

* fix(layers): select several frames and canvas shapes with ⇧/⌘-click

Top-level rows ignored the modifier keys, so two frames or two canvas
shapes could not be selected together from the Layers panel. ⇧/⌘-click
now adds a root row to the selection or drops it, every selected root row
is highlighted, ⌫ in the tree deletes all of them, and the arrow keys find
a canvas shape selected as a whole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(layers): keep a shape locked on its own layer out of a ⌫ on the selection

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 6a179657449b26720729319890175db2475da399)
* feat(comments): @mention people and copy a link to a comment

Typing @ in a comment, a thread reply or the Comments panel lists the canvas's
people (owner, members, workspace members) and, for editors, its agents. A
mentioned person is emailed at once and left out of that comment's digest.
Names are resolved once against everyone eligible, with the ids the picker
chose for a name several people share, and the agent matcher reads the text
with people blanked out, so a person named like an agent never starts one.
Agents tag people the same way through MCP and the resident.

Pins and Comments panel rows get a "Copy link to comment" right-click item,
and an open thread a link button; a link follows its thread to its current
frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(comments): address review of mentions and comment links

- send only the latest pick of a shared name, and forget picks once the
  draft empties, so an earlier Sam is not emailed again
- an agent picked over a person named like its handle stays the agent's
- every reader of the canvas's people redraws when the list arrives, so a
  thread's mentions highlight without waiting for another render
- a comment link to a thread on another page opens the thread

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b2fc825b7025b9e6827a827cad23533c15f75fe5)
…⇧⌘G (#592)

* feat(canvas): group shapes on the canvas with ⌘G and split them with ⇧⌘G

⌘G on two or more standalone shapes keeps the frontmost one's frame, so
its id, comments, versions and place in the stack stay, and moves the
other shapes' layers into it inside one group layer placed by percentages.
The other frames go, all as one undo step. A shape whose frame would go is
refused when it carries comments or a component main. ⇧⌘G splits such a
group back into shapes, the frame keeping the frontmost.

Every write is conditional on the version the press saw: a refused group
save puts every shape back, and a shape a teammate edited meanwhile stays
on the canvas and leaves the group. Ids that clash are renamed and each
shape's carried CSS keeps its own sheet; hidden and renamed shapes stay
hidden and named as layers; a turned path keeps its box and transform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(canvas): type the canvas group test's comments and API error like the app's

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(canvas): guard canvas group undo/redo and refuse splits it can't keep

Undo/redo of a group or split refuses once a teammate saved a frame it
would overwrite or delete. Grouping or splitting refuses to move a frame
under comments pinned to it, and a turned or flipped group isn't split.
The whole split is tracked so a pending undo waits for it, and a late
split leaves a newer selection alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(canvas): tell a teammate's save from your own in group undo, keep group comments and hiding

Undo of a canvas group or split counted any newer save as a teammate's, so
the person's own later move and its undo blocked it. It now reads the saves
the room reports from someone else. A split is refused when the group's
wrapper has comments, and a hidden group splits into hidden shapes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(canvas): keep a teammate's newer save when a canvas group fails to save

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(canvas): keep group undo and redo off a teammate's save that lands while they run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(history): call unguarded saves as before

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(history): show the server's frame, not the old copy, when an undo write conflicts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0a5e1830c55335245d616894ac9c96ea311af4bd)
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit ffd3d32a6958dc9da5c856f5509a34fbf5c60e8e)
* feat(frames): refuse long blocks of base64 text in agent writes

The guard against base64 data: URIs missed base64 with no data: in front of it. One canvas
held 6 MB of it per frame, gzipped script bundles and a JSON file of pre-rendered pages in
string literals, and fifty kept versions of each of its 91 frames came to 13 GB. A write
that adds a run of 4,096 or more base64 characters is now refused with what to do instead.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(frames): join streamed pieces of a base64 block, exempt only a real data: URI's payload

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(frames): review fixes for the base64 guard

A block wrapped over lines or written as joined strings is one block. A block the frame
holds may come back smaller or in pieces: what is counted is what the frame did not hold.
A rewrite may carry over every form the frame was read in. A refusal mid-stream says the
earlier pieces are in the frame and to start again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 01091d1d7aa1bc5bea94c4eb9efcccafb179d5fc)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect canvas editing, comments, and agent workflows across the app.

Fix ungrouping edited groups before merging; it can change the saved design's layout.

Findings

  1. P1 Ungrouping changes edited shapes ▶
  2. P2 Cut removes locked shapes ▶
  3. P2 Hidden overflow escapes inspection ▶
  4. P2 Clean text triggers overlap warnings ▶
  5. P2 Wrapped streams bypass base64 limit ▶

Summary

Adds canvas cut, shape grouping, distance guides, people mentions, comment links, richer agent inspection, and sharper iOS rendering.

  • Selected canvas shapes can become one group and split back apart.
  • People can cut selected frames and elements from the canvas.
  • Comment fields can mention canvas people and link straight to threads.
  • Agents can inspect a rendered frame and get a report of layout problems.
  • Agent frame writes refuse newly added large base64 blocks.
  • Holding Option shows distances from the current selection.
  • The Layers panel can select several frames and shapes together.
  • Open comment threads stay above the frame size badge.
  • The element toolbar no longer appears over a picked canvas element.
  • The home composer row fits on phone screens.
  • iOS frames stay sharp at every zoom level.
  • Project notes and the brand mark change without changing product behavior.

The review found problems with ungrouping edited groups, cutting locked shapes, two layout checks, and the streamed base64 limit.

Reviews (1) · Last reviewed commit: "test(canvas): expect Cut at the top of t..." · Reviewed by Greptile

Comment thread src/lib/canvasGroups.ts
Comment on lines +340 to +342
const scope = newScope()
const el = elementOf(scopeMarkup(markup, scope))
const at = el && boxIn(el, host)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Ungrouping changes edited shapes. boxIn(el, host) reads child percentages against the frame, not the group wrapper. The element panel lets users change the wrapper's size without changing the frame. In a 400px frame, shrinking the wrapper to 200px makes a 50%-wide child render at 100px; ungrouping makes it 200px wide again. Wrapper offsets are also lost. Measure against the wrapper's actual box, or refuse the split when it no longer fills the frame.

Comment on lines +97 to +99
() => {
const cut = live.filter((f) => !f.locked)
if (cut.length) deleteFramesTracked(cut)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Cut removes locked shapes. The new frame-menu Cut checks only frame.locked. A standalone shape can instead be locked on its own layer. Select that shape together with a regular frame in Layers, then Cut from the frame's menu: both are deleted. Use isStackLocked here so menu Cut preserves the same shapes as keyboard Cut.

Comment thread server/screenshot.ts
Comment on lines +444 to +451
for (let node = el.parentElement; node; node = node.parentElement) {
const style = getComputedStyle(node)
if (style.overflowX === 'visible' && style.overflowY === 'visible') continue
const clip = node.getBoundingClientRect()
left = Math.max(left, clip.left)
top = Math.max(top, clip.top)
right = Math.min(right, clip.right)
bottom = Math.min(bottom, clip.bottom)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Hidden overflow escapes inspection. shownRect clips each element to the root before checking whether it extends past the frame. With html or body sized to the frame and overflow:hidden, text extending past the right or bottom edge is trimmed to the boundary and gets no off-frame report. The later clipping check visits only body descendants, so it cannot catch the root's clipping either. Keep the frame boundary separate from intentional clipping inside the design.

Comment thread server/screenshot.ts
Comment on lines +526 to +530
/* each line box of wrapped inline text, not the box around all its lines, which
covers whatever sits beside the first and last line */
const sized = leaves.slice(0, 400).map((el) => {
const shown = shownRect(el)
const lines = Array.from(el.getClientRects())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Clean text triggers overlap warnings. getClientRects() returns the whole box for a block such as p, not the boxes of its text lines. For example, a short paragraph beside a right-floated badge has a full-width block box even though its text wraps clear of the badge. This check reports an overlap anyway. Measure the text with a Range so empty space inside a block does not count as overlapping text.

Comment thread server/actions.ts
Comment on lines +1817 to +1820
/* enough for a data: URI's prefix split across two chunks, and for a block of base64 text sent
in pieces: a run is refused once it reaches EMBEDDED_MIN_LENGTH (server/inlineData.ts), so one
still growing at the end of the stream is shorter than that and is held here whole */
const STREAM_TAIL_CHARS = Math.max(256, EMBEDDED_MIN_LENGTH)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Wrapped streams bypass base64 limit. The saved tail holds 4,096 raw characters, but the limit counts base64 characters without newlines or string joins. With 76-column wrapping and chunks of at most 32 characters, the tail contains at most 4,043 base64 characters. Adding the next chunk still cannot reach 4,096, so an arbitrarily long block passes every check. Retain the unfinished run by its base64 count, including the joins needed to recognize it.

@kgoedecke
kgoedecke merged commit a1e74f5 into main Nov 19, 2026
13 checks passed
VTalleyrand pushed a commit to VTalleyrand/doop that referenced this pull request Nov 20, 2026
…ign#549)

The frame Inspector drew the rotation prefix as a tiny ∠ text glyph; the
element panel had a hand-drawn icon. Both now use Lucide's Angle.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9bcca5e855b5699189d3d143984ecf2ac29227df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant